import {reactive} from "plain-ui-composition";
import {useVisualEditorMenuPanelComponents} from "./element/ElementPanel";
import {useVisualEditorMenuPanelHistory} from "./history/HistoryMenuPanel";
import {useVisualEditorMenuPanelStructure} from "./structure/StructureMenuPanel";


/**
 * 菜单面板内容管理组合函数
 */
export function useVisualEditorMenuPanel(editor) {
  /*面板管理*/
  const menuList = reactive([]);

  const registryPanel = (panel) => {
    menuList.push(panel);
  };

  /*所有组件面板*/
  useVisualEditorMenuPanelComponents({ registryPanel, ...editor });
  /*页面结构面板*/
  useVisualEditorMenuPanelHistory({ registryPanel, ...editor });
  /*操作历史面板*/
  useVisualEditorMenuPanelStructure({ registryPanel, ...editor });

  return { menuList, registryPanel };
}
